package com.xs.designpattern;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

/**
 * @author xs
 */
@Setter
@Slf4j
@Getter
public abstract class Target {
    private Size size;

    private Visibility visibility;

    /**
     * 打印状态
     */
    public void printStatus() {
        log.info("{}, [大小={}] [透明度={}]", this, getSize(), getVisibility());
    }

    /**
     * 更改目标的大小
     */
    public void changeSize() {
        //更改体型大小，如果为正常的则变小，如果是变小的则恢复正常
        Size oldSize = getSize() == Size.NORMAL ? Size.SMALL : Size.NORMAL;
        setSize(oldSize);
    }

    /**
     * 更改目标的可见性
     */
    public void changeVisibility() {
        //更改可见性，如果为正常的变透明，如果是透明的的则恢复正常
        Visibility visible = getVisibility() == Visibility.INVISIBLE ? Visibility.VISIBLE : Visibility.INVISIBLE;
        setVisibility(visible);
    }
}
